package maggames.core;

import java.util.Random;

/**
 * Enum contain default game states
 * 
 * @author BenjaminPLee
 * @version 1.0
 */
public enum GameState {
	/**
	 * Inital game state. Generally used during initial setup of game environment
	 * and setting of game properties.
	 */
	INIT,

	/**
	 * Setting up the initial board.  This can either be done a set way via the game
	 * engine, or by the players.
	 */
	SETUP,
	
	/**
	 * Normal game play.  A single player will have their turn at one time.  Generally
	 * this state continues until a WIN state is produced or the game is exited.
	 */
	TURNS,
	
	/**
	 * Final game state when one or no players are declared the winner. 
	 */
	WIN;
	
	/**
	 * Returns a randomly chosen GameState.
	 * 
	 * @return random GameState
	 */
	public static GameState getRandom() {
		Random rand = new Random();
		GameState [] states = GameState.values();
		int index = rand.nextInt(states.length);
		
		return states[index];
	}
}
